#pragma once

#pragma unmanaged

#include <BWSAL\TaskScheduler.h>

#pragma managed

#include "..\AiBase.h"
#include "Interfaces\ITaskScheduler.h"
#include "Interfaces\IBuildEventTimeline.h"
#include "Interfaces\IBuildUnitManager.h"

using namespace BroodWar;

namespace BroodWar
{
	namespace Addon
	{
		ref class BuildEventTimeline;
		ref class Task;
		ref class BuildUnit;
		ref class BuildUnitManager;

		public ref class TaskScheduler : public AiBase, ITaskScheduler
		{
		internal:
			BWSAL::TaskScheduler* instance;

			TaskScheduler(BWSAL::TaskScheduler* scheduler);
			~TaskScheduler();
			!TaskScheduler();

			static TaskScheduler^ s_instance;
		public:
			static void Create(IBuildEventTimeline^ timeline, IBuildUnitManager^ buildUnitManager);
			static property TaskScheduler^ Instance { TaskScheduler^ get(); }

			virtual TaskPlan^ ScheduleTask(Task^ t);
			virtual bool FinalizeSchedule();
			virtual property int InsufficientTypes { int get(); }
			virtual property int SupplyBlockTime { int get(); }
			virtual void ResetSupplyBlockTime();
			virtual property int LastMineralBlockTime { int get(); }
			virtual void ResetLastMineralBlockTime();
			virtual property int LastGasBlockTime { int get(); }
			virtual void ResetLastGasBlockTime();
			virtual property BuildEventTimeline^ Timeline { BuildEventTimeline^ get(); }
		};
	}
}
